package cn.iocoder.yudao.module.handguard.dal.mysql.matchinginfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.handguard.dal.dataobject.matchinginfo.MatchingInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.handguard.controller.app.matchinginfo.vo.*;

/**
 * 产品类型-补充资料内容-匹配 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MatchingInfoMapper extends BaseMapperX<MatchingInfoDO> {

    default PageResult<MatchingInfoDO> selectPage(MatchingInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MatchingInfoDO>()
                .eqIfPresent(MatchingInfoDO::getProductId, reqVO.getProductId())
                .likeIfPresent(MatchingInfoDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(MatchingInfoDO::getCategory, reqVO.getCategory())
                .betweenIfPresent(MatchingInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MatchingInfoDO::getId));
    }

    default List<MatchingInfoDO> selectList(MatchingInfoExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MatchingInfoDO>()
                .eqIfPresent(MatchingInfoDO::getProductId, reqVO.getProductId())
                .likeIfPresent(MatchingInfoDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(MatchingInfoDO::getCategory, reqVO.getCategory())
                .betweenIfPresent(MatchingInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MatchingInfoDO::getId));
    }

}
